function togglettqaddress(){
    $(".header-wrap .header-center .header_logobox .weather-or-city").toggleClass("showaddress")
}

// 定制天气
function customized(){
    // 获取邮政编号
   // var province = $('#distpicker').find('option:selected').eq(0).attr("data-code");
   // var city = $('#distpicker').find('option:selected').eq(1).attr("data-code");
   // var district = $('#distpicker').find('option:selected').eq(2).attr("data-code");
    // 获取文本值
   var province = $('#distpicker').find('option:selected').eq(0).text();
   var city = $('#distpicker').find('option:selected').eq(1).text();
   var district = $('#distpicker').find('option:selected').eq(2).text();
   console.log(province + city + district);
    // 定制位置
   $('[data-toggle="distpicker"]').distpicker('destroy')
   $('[data-toggle="distpicker"]').distpicker({
     province: "湖北省",
     city: "黄冈市",
     district: "黄州区",
     autoSelect: false,  //自动选择
 });
 togglettqaddress() //关闭地址选择框
 }

//  百度搜索板块的js
if($(".baidusearch .link_a .swiper-slide").size()>=1){
    var swiper = new Swiper(".baidusearch .link_a", {
        loop:true,
        speed:500,
        autoplay: {
            delay: 10000,
        },
      direction: "vertical",
    });
}
$(".baidusearch .search_tab a").on("click",function(e){
    if(!$(this).hasClass("active")){
        e.preventDefault();
        $(this).addClass("active").siblings().removeClass("active");
        $(".baidusearch > .flex1 form").attr("action",$(this).attr("href"))
    } 
})
$(".baidusearch .search_tab a").on("dblclick",function(e){
    window.open($(this).attr("href"))
})

// 定位百度搜索栏
if($(".baidusearchwarp").size()>=1){
    var bgTH=110;
    isIE6 = function () {return !!window.ActiveXObject && !window.XMLHttpRequest;} //判断IE6;
     function scroll_ad(){
     var wt = $(window).scrollTop();
         t = wt >= bgTH ? isIE6() == true ? wt : 0 : bgTH - wt;
         $('.baidusearchwarp').css({"position":'fixed',"z-index":"10","left":"0", 'top':t+'px','margin-bottom':'0px'});
         $('.header-center').css({"height":'204px' });
     }
    scroll_ad();
     $(window).scroll(function() {scroll_ad();});
    
}
